/**
 * 系统左侧导航视图区
 */

Ext.define('gytoa.view.main.region.Left', {
	extend : 'Ext.panel.Panel',
	alias : 'widget.leftmenubar',
    requires: [
        'gytoa.model.main.region.LeftModel'
    ],
	header: {
		xtype:'header',
		title:'系统菜单'
	},

	layout : {
		type : 'accordion',
		animate : !Ext.browser.is.IE8
	},  

	viewModel: {
        type: 'left'
    },

	controller: 'left',

	initComponent: function() {
		var me =this;
		me.items =[];
		var systems = this.getViewModel().get('sysytems');
	
		Ext.Array.each(systems, function(system, index) {

			var treepanel = Ext.create('Ext.tree.Panel', {
				title: system.name,
				bind:{
					store: '{leftmenustore}'
				},
				listeners: {
					selectionchange: 'onMenuBtnClick'
				}
		    });
			me.items.push(treepanel);
		});   
 
		me.callParent(arguments);
    }
})